/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.birrap.webservicebirrap;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Denver
 */
@Entity
@Table(name = "BARES_T")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "BaresT.findAll", query = "SELECT b FROM BaresT b"),
    @NamedQuery(name = "BaresT.findByIdBar", query = "SELECT b FROM BaresT b WHERE b.idBar = :idBar"),
    @NamedQuery(name = "BaresT.findByNombre", query = "SELECT b FROM BaresT b WHERE b.nombre = :nombre"),
    @NamedQuery(name = "BaresT.findByDireccion", query = "SELECT b FROM BaresT b WHERE b.direccion = :direccion"),
    @NamedQuery(name = "BaresT.findByTelefono", query = "SELECT b FROM BaresT b WHERE b.telefono = :telefono"),
    @NamedQuery(name = "BaresT.findByCodigoPostal", query = "SELECT b FROM BaresT b WHERE b.codigoPostal = :codigoPostal"),
    @NamedQuery(name = "BaresT.findByLatitud", query = "SELECT b FROM BaresT b WHERE b.latitud = :latitud"),
    @NamedQuery(name = "BaresT.findByLongitud", query = "SELECT b FROM BaresT b WHERE b.longitud = :longitud"),
    @NamedQuery(name = "BaresT.findByFoto", query = "SELECT b FROM BaresT b WHERE b.foto = :foto")})
public class BaresT implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_BAR")
    private Integer idBar;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 40)
    @Column(name = "NOMBRE")
    private String nombre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "DIRECCION")
    private String direccion;
    @Column(name = "TELEFONO")
    private Integer telefono;
    @Basic(optional = false)
    @NotNull
    @Column(name = "CODIGO_POSTAL")
    private int codigoPostal;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "LATITUD")
    private Double latitud;
    @Column(name = "LONGITUD")
    private Double longitud;
    @Size(max = 50)
    @Column(name = "FOTO")
    private String foto;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "baresT")
    private Collection<BaresCervezasTapasVasosT> baresCervezasTapasVasosTCollection;

    public BaresT() {
    }

    public BaresT(Integer idBar) {
        this.idBar = idBar;
    }

    public BaresT(Integer idBar, String nombre, String direccion, int codigoPostal) {
        this.idBar = idBar;
        this.nombre = nombre;
        this.direccion = direccion;
        this.codigoPostal = codigoPostal;
    }

    public Integer getIdBar() {
        return idBar;
    }

    public void setIdBar(Integer idBar) {
        this.idBar = idBar;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDireccion() {
        return direccion;
    }

    public void setDireccion(String direccion) {
        this.direccion = direccion;
    }

    public Integer getTelefono() {
        return telefono;
    }

    public void setTelefono(Integer telefono) {
        this.telefono = telefono;
    }

    public int getCodigoPostal() {
        return codigoPostal;
    }

    public void setCodigoPostal(int codigoPostal) {
        this.codigoPostal = codigoPostal;
    }

    public Double getLatitud() {
        return latitud;
    }

    public void setLatitud(Double latitud) {
        this.latitud = latitud;
    }

    public Double getLongitud() {
        return longitud;
    }

    public void setLongitud(Double longitud) {
        this.longitud = longitud;
    }

    public String getFoto() {
        return foto;
    }

    public void setFoto(String foto) {
        this.foto = foto;
    }

    @XmlTransient
    public Collection<BaresCervezasTapasVasosT> getBaresCervezasTapasVasosTCollection() {
        return baresCervezasTapasVasosTCollection;
    }

    public void setBaresCervezasTapasVasosTCollection(Collection<BaresCervezasTapasVasosT> baresCervezasTapasVasosTCollection) {
        this.baresCervezasTapasVasosTCollection = baresCervezasTapasVasosTCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idBar != null ? idBar.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BaresT)) {
            return false;
        }
        BaresT other = (BaresT) object;
        if ((this.idBar == null && other.idBar != null) || (this.idBar != null && !this.idBar.equals(other.idBar))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.birrap.webservicebirrap.BaresT[ idBar=" + idBar + " ]";
    }
    
}
